﻿using System;
using System.Collections.Generic;

namespace Service.Infrastructure.Result
{
    /// <summary>
    ///     服务层处理结果
    /// </summary>
    public abstract class ServiceResult
    {
        protected const String KeyIsNotFound = "系统返回的信息，并未在程序中定义";

        public static readonly Dictionary<ResultType, String> CodeMagsDict = new Dictionary<ResultType, string>
        {
            {ResultType.Error,"太多人了，系统休息一下"},
            {ResultType.Success,"成功"},
            {ResultType.False,"失败"},
            {ResultType.OperateAddIsSuccess,"数据新增成功"},
            {ResultType.OperateDeleteIsSuccess,"数据删除成功"},
            {ResultType.OperateQueryIsSuccess,"数据查询成功"},
            {ResultType.OperateUpdateIsSuccess,"数据更新成功"},
            {ResultType.AccountLoginSuccess,"登录成功"},
            {ResultType.AccountLoginFaile,"登录失败"},
            {ResultType.ParamIsError,"参数不正确"},
            {ResultType.ParmamIsNull,"参数为空"},

        };

        protected ResultType Code;

        /// <summary>
        ///     方便序列化
        /// </summary>
        public Object ReCode
        {
            get { return Code; }
        }

        protected Object Data;

        /// <summary>
        ///     方便序列化
        /// </summary>
        public Object ReData
        {
            get { return Data; }
        }


        public abstract Object GetCode();

        public abstract void SetCode(Object lgCode);

        public abstract Object GetData();

        public abstract void SetData(Object lgData);


        /// <summary>
        ///     处理结果是否成功
        /// </summary>
        /// <returns></returns>
        [Obsolete]
        public abstract bool GetSuccess();

        /// <summary>
        ///     获取返回信息
        /// </summary>
        /// <returns></returns>
        public abstract String GetMsg();

    }





}